<?php

/*
 * ************************************************* 
 * Created on :2012-5-5 23:05:41
 * Encoding   :UTF-8
 * Description:
 * 
 * @Author @lqs <soso2501@gmail.com>
 * @WAP_WEIBO (C)1996-2099 SINA Inc. 
 * ************************************************
 */

class bainianxiaoqing extends Controller {

    public function init() {
        $this->selfc = 'bainianxiaoqing';
        $this->tpl->assign("title", "河北工业大学校友会-百年校庆");
        $this->tpl->assign("selfcname", "百年校庆");
        $leftnav = array(
            array("name" => "校庆精选文稿汇编", "link" => "/$this->selfc/hb"),
            array("name" => "校庆视频", "link" => "/$this->selfc/sp"),
            array("name" => "校庆相册", "link" => "/$this->selfc/xc"),
        );
        $this->tpl->assign("leftnav", $leftnav);
    }

    public function index() {
        $this->hb();
    }

    public function hb() {
        $this->_news("校庆精选文稿汇编");
    }

    public function sp() {
        
    }

    public function xc() {
        $this->tpl->assign("selfaname", "校庆相册");
        $condition = "project='celebration'";

        $n = Photo::countalbumbycondition($condition);
        list($paging, $offset) = Toolfunc::paging($n);
        //db::debug();
        $this->tpl->assign("paging", $paging);
        $albums = Photo::albumbycondition($condition, $offset, PAGE_SIZE);
        $this->tpl->assign("albums", $albums);
        
        $this->tpl->assign("module", "album");
        $this->tpl->display("include/mainfw.html");
    }

    //纯示例
    public function photo() {
        $albumid = empty($_REQUEST['albumid']) ? '' : intval($_REQUEST['albumid']);
        $album = Photo::albumbyid($albumid);
        if (!$album) {
            header("location:/{$this->selfc}/xc");
            return;
        }
        $this->tpl->assign("album", $album);
        $this->tpl->assign("selfaname", "捐赠相册>>{$album['name']}");
        //DB::Debug();
        $n = Photo::countphotobyalbumid($albumid);
        list($paging, $offset) = Toolfunc::paging($n);
        $this->tpl->assign("paging", $paging);
        $photos = Photo::photobyalbumid($albumid, $offset, PAGE_SIZE);
        $this->tpl->assign("photos", $photos);
        
        $this->tpl->assign("module", "photolist");
        $this->tpl->display("include/mainfw.html");
    }

}

/* End of file bainianxiaoqing */


